class GitDataTags
  attr_accessor :github

  def initialize(github)
    @github = github
  end

  def getTag(repo, sha, user=nil)
    username = user == nil ? @github.username : user
    @github.get(
        'repos/%s/%s/git/tags/%s' % [username, repo, sha])
  end

  def createTagObject(repo, tag, message, object, type, taggerName,
      taggerEmail, taggerDate, user=nil)
    username = user == nil ? @github.username : user
    tagger = {
        :name => taggerName,
        :email => taggerEmail,
        :date => taggerDate
    }
    params = {
        :tag => tag,
        :message => message,
        :object => object,
        :type => type,
        :tagger => tagger
    }
    data = params.to_json
    url = 'repos/%s/%s/git/tags' % [user, repo]
    @github.post(url % [username, repo], data)
  end
end
